package com.qiyi.player.wonder.plugins.controllbar.view.seekbar
{
   import flash.display.Sprite;
   import controllbar.SeekBarUI;
   import com.qiyi.player.wonder.common.status.Status;
   import com.qiyi.components.preview.container.Preview;
   import flash.utils.Timer;
   import com.qiyi.player.core.model.ISkipPointInfo;
   import flash.display.Shape;
   import flash.display.SimpleButton;
   import com.iqiyi.components.global.GlobalStage;
   import com.qiyi.player.wonder.plugins.controllbar.ControllBarDef;
   import flash.events.MouseEvent;
   import com.qiyi.player.core.model.impls.FocusTip;
   import com.qiyi.player.base.utils.Strings;
   import com.qiyi.player.wonder.common.utils.ConstUtils;
   import com.qiyi.player.wonder.plugins.controllbar.view.ControllBarEvent;
   import flash.geom.Point;
   import gs.TweenLite;
   import com.qiyi.player.wonder.common.pingback.PingBack;
   import com.qiyi.player.wonder.common.pingback.PingBackDef;
   import flash.events.TimerEvent;
   import com.qiyi.components.preview.events.PreviewEvent;
   import com.qiyi.player.wonder.common.config.FlashVarConfig;
   
   public class SeekBarView extends Sprite
   {
      
      public function SeekBarView(param1:Status) {
         this._thickBarsHeight = new Object();
         this._viewPoints = new Vector.<FocusPoint>();
         this._videoHeadTailTipPanel = new VideoHeadTailTipPanel();
         super();
         this._status = param1;
         this._timer = new Timer(40);
         this._seekBarUI = new SeekBarUI();
         this._seekBarUI.bg.mouseEnabled = false;
         this._seekBarUI.bg.mouseChildren = false;
         this._seekBarUI.loadBar.mouseChildren = false;
         this._seekBarUI.loadBar.mouseEnabled = false;
         this._seekBarUI.playBar.mouseChildren = false;
         this._seekBarUI.playBar.mouseEnabled = false;
         this._seekBarUI.playBarHead.mouseChildren = false;
         this._seekBarUI.playBarHead.mouseEnabled = false;
         this._seekBarUI.forWardBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onForWardBtnMouseDown);
         this._seekBarUI.backWardBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onBackWardBtnMouseDown);
         this._seekBarUI.slider.addEventListener(MouseEvent.MOUSE_DOWN,this.onSliderDown);
         this._seekBarUI.seekBarBg.body.addEventListener(MouseEvent.CLICK,this.onSeekBarBgClick);
         this._seekBarUI.seekBarBg.body.addEventListener(MouseEvent.MOUSE_MOVE,this.onSeekBarBgMouseMove);
         this._seekBarUI.seekBarBg.body.addEventListener(MouseEvent.ROLL_OUT,this.onSeekBarBgRollOut);
         this.initUI();
      }
      
      private static const FILTER_COLOUR:uint = 11879694;
      
      private var _seekBarUI:SeekBarUI;
      
      private var _totalTime:int = 1;
      
      private var _currentTime:int;
      
      private var _bufferTime:int;
      
      private var _mouseDowned:Boolean = false;
      
      private var _mouseMoved:Boolean = false;
      
      private var _status:Status;
      
      private var _thickBarsHeight:Object;
      
      private var _focusPointHead:FocusPoint = null;
      
      private var _focusPointTail:FocusPoint = null;
      
      private var _viewPoints:Vector.<FocusPoint>;
      
      private var _videoHeadTailTipPanel:VideoHeadTailTipPanel;
      
      private var _previewTip:Preview;
      
      private var _timer:Timer;
      
      private var _seekCount:int = 0;
      
      private var _seekBtnDowned:Boolean = false;
      
      private var _seekTime:int;
      
      private var _seekClickCount:int;
      
      private var _previewVedioShown:Boolean;
      
      private var _filterData:Vector.<ISkipPointInfo>;
      
      private var _filterShape:Shape;
      
      public function get forWardBtn() : SimpleButton {
         return this._seekBarUI.forWardBtn;
      }
      
      public function get backWardBtn() : SimpleButton {
         return this._seekBarUI.backWardBtn;
      }
      
      public function get seekTime() : int {
         return this._seekTime;
      }
      
      public function set seekTime(param1:int) : void {
         this._seekTime = param1;
      }
      
      public function get totalTime() : int {
         return this._totalTime;
      }
      
      public function get currentTime() : int {
         return this._currentTime;
      }
      
      public function get videoHeadTailTipPanel() : VideoHeadTailTipPanel {
         return this._videoHeadTailTipPanel;
      }
      
      public function get previewTip() : Preview {
         return this._previewTip;
      }
      
      public function get seekClickCount() : int {
         return this._seekClickCount;
      }
      
      public function set isPreviewTipEnable(param1:Boolean) : void {
         this._previewTip.enabled = param1;
      }
      
      public function onAddStatus(param1:int) : void {
         switch(param1)
         {
            case ControllBarDef.STATUS_SEEK_BAR_SHOW:
               this.visible = true;
               this.onResize(GlobalStage.stage.stageWidth,GlobalStage.stage.stageHeight);
               break;
            case ControllBarDef.STATUS_SEEK_BAR_THICK:
               this._seekBarUI.bg.visible = true;
               this._seekBarUI.seekBarBg.head.visible = true;
               this._seekBarUI.seekBarBg.tail.visible = true;
               this._seekBarUI.backWardBtn.visible = true;
               this._seekBarUI.forWardBtn.visible = true;
               this._seekBarUI.slider.visible = true;
               if(this._filterData == null)
               {
                  this._seekBarUI.loadBar.head.visible = true;
                  this._seekBarUI.loadBar.tail.visible = true;
               }
               this._seekBarUI.playBar.head.visible = true;
               this._seekBarUI.playBar.tail.visible = true;
               this._seekBarUI.playBarHead.visible = false;
               this.onResize(GlobalStage.stage.stageWidth,GlobalStage.stage.stageHeight);
               this.y = 1;
               break;
         }
      }
      
      public function setHeadTailPoint(param1:int, param2:int) : void {
         if((this._focusPointHead) && (this._focusPointHead.parent))
         {
            this._focusPointHead.removeEventListener(MouseEvent.ROLL_OVER,this.onFocusPointHeadTailRollOver);
            this._focusPointHead.removeEventListener(MouseEvent.ROLL_OUT,this.onFocusPointHeadTailRollOut);
            removeChild(this._focusPointHead);
         }
         if((this._focusPointTail) && (this._focusPointTail.parent))
         {
            this._focusPointTail.removeEventListener(MouseEvent.ROLL_OVER,this.onFocusPointHeadTailRollOver);
            this._focusPointTail.removeEventListener(MouseEvent.ROLL_OUT,this.onFocusPointHeadTailRollOut);
            removeChild(this._focusPointTail);
         }
         if(param1 > 0)
         {
            this._focusPointHead = new FocusPoint();
            this._focusPointHead.buttonMode = true;
            this._focusPointHead.useHandCursor = true;
            this._focusPointHead.time = param1;
            this._focusPointHead.addEventListener(MouseEvent.ROLL_OVER,this.onFocusPointHeadTailRollOver);
            this._focusPointHead.addEventListener(MouseEvent.ROLL_OUT,this.onFocusPointHeadTailRollOut);
            addChild(this._focusPointHead);
         }
         if(param2 > 0)
         {
            this._focusPointTail = new FocusPoint();
            this._focusPointTail.buttonMode = true;
            this._focusPointTail.useHandCursor = true;
            this._focusPointTail.time = param2;
            this._focusPointTail.addEventListener(MouseEvent.ROLL_OVER,this.onFocusPointHeadTailRollOver);
            this._focusPointTail.addEventListener(MouseEvent.ROLL_OUT,this.onFocusPointHeadTailRollOut);
            addChild(this._focusPointTail);
         }
      }
      
      public function setViewPoints(param1:Vector.<FocusTip>) : void {
         var _loc3_:* = 0;
         var _loc4_:FocusPoint = null;
         var _loc2_:* = 0;
         if(this._viewPoints)
         {
            _loc3_ = this._viewPoints.length;
            _loc2_ = 0;
            while(_loc2_ < _loc3_)
            {
               this._viewPoints[_loc2_].removeEventListener(MouseEvent.ROLL_OVER,this.onViewPointRollOver);
               this._viewPoints[_loc2_].removeEventListener(MouseEvent.ROLL_OUT,this.onViewPointRollOut);
               this._viewPoints[_loc2_].addEventListener(MouseEvent.CLICK,this.onViewPointClick);
               removeChild(this._viewPoints[_loc2_]);
               _loc2_++;
            }
            this._viewPoints = new Vector.<FocusPoint>();
         }
         if(!(param1 == null) && param1.length > 0)
         {
            _loc2_ = 0;
            while(_loc2_ < param1.length)
            {
               _loc4_ = new FocusPoint();
               _loc4_.buttonMode = true;
               _loc4_.useHandCursor = true;
               _loc4_.time = param1[_loc2_].timestamp;
               _loc4_.content = param1[_loc2_].content;
               _loc4_.addEventListener(MouseEvent.ROLL_OVER,this.onViewPointRollOver);
               _loc4_.addEventListener(MouseEvent.ROLL_OUT,this.onViewPointRollOut);
               _loc4_.addEventListener(MouseEvent.CLICK,this.onViewPointClick);
               this._viewPoints.push(_loc4_);
               addChild(_loc4_);
               _loc2_++;
            }
         }
      }
      
      public function setSkipPoints(param1:Vector.<ISkipPointInfo>) : void {
         this._filterData = param1;
         if(this._filterData)
         {
            this._filterShape.visible = false;
            this._seekBarUI.loadBar.visible = true;
         }
         else
         {
            this._filterShape.visible = true;
            this._seekBarUI.loadBar.visible = false;
         }
         this.onResize(GlobalStage.stage.stageWidth,GlobalStage.stage.stageHeight);
      }
      
      public function onRemoveStatus(param1:int) : void {
         switch(param1)
         {
            case ControllBarDef.STATUS_SEEK_BAR_SHOW:
               this.visible = false;
               break;
            case ControllBarDef.STATUS_SEEK_BAR_THICK:
               this._seekBarUI.bg.visible = false;
               this._seekBarUI.seekBarBg.head.visible = false;
               this._seekBarUI.seekBarBg.tail.visible = false;
               this._seekBarUI.backWardBtn.visible = false;
               this._seekBarUI.forWardBtn.visible = false;
               this._seekBarUI.slider.visible = false;
               this._seekBarUI.loadBar.head.visible = false;
               this._seekBarUI.loadBar.tail.visible = false;
               this._seekBarUI.playBar.head.visible = false;
               this._seekBarUI.playBar.tail.visible = false;
               this._seekBarUI.playBarHead.visible = true;
               this.onResize(GlobalStage.stage.stageWidth,GlobalStage.stage.stageHeight);
               this.y = 5;
               break;
         }
      }
      
      public function onResize(param1:int, param2:int) : void {
         var _loc3_:* = 0;
         var _loc4_:uint = 0;
         this._seekBarUI.bg.width = param1;
         if(this._status.hasStatus(ControllBarDef.STATUS_SEEK_BAR_THICK))
         {
            this._seekBarUI.seekBarBg.height = this._thickBarsHeight.seekBarBgH;
            this._seekBarUI.loadBar.height = this._thickBarsHeight.loadBarH;
            this._seekBarUI.playBar.height = this._thickBarsHeight.playBarH;
            this._seekBarUI.backWardBtn.x = 0;
            this._seekBarUI.seekBarBg.x = 0;
            this._seekBarUI.seekBarBg.head.x = this._seekBarUI.backWardBtn.width;
            this._seekBarUI.seekBarBg.body.x = this._seekBarUI.backWardBtn.width + this._seekBarUI.seekBarBg.head.width;
            this._seekBarUI.seekBarBg.body.width = param1 - this._seekBarUI.forWardBtn.width - this._seekBarUI.backWardBtn.width - this._seekBarUI.seekBarBg.head.width - this._seekBarUI.seekBarBg.tail.width;
            this._seekBarUI.seekBarBg.tail.x = this._seekBarUI.seekBarBg.body.x + this._seekBarUI.seekBarBg.body.width;
            this._seekBarUI.loadBar.x = 0;
            this._seekBarUI.loadBar.head.x = this._seekBarUI.backWardBtn.width;
            this._seekBarUI.loadBar.body.x = this._seekBarUI.loadBar.head.x + this._seekBarUI.loadBar.head.width;
            this._seekBarUI.loadBar.body.width = 1 * this._seekBarUI.seekBarBg.body.width * this._bufferTime / this._totalTime;
            this._seekBarUI.loadBar.tail.x = this._seekBarUI.loadBar.body.x + this._seekBarUI.loadBar.body.width;
            this._seekBarUI.playBar.x = 0;
            this._seekBarUI.playBar.head.x = this._seekBarUI.backWardBtn.width;
            this._seekBarUI.playBar.body.x = this._seekBarUI.playBar.head.x + this._seekBarUI.playBar.head.width;
            this._seekBarUI.playBar.body.width = 1 * this._seekBarUI.seekBarBg.body.width * this._currentTime / this._totalTime;
            this._seekBarUI.playBar.tail.x = this._seekBarUI.playBar.body.x + this._seekBarUI.playBar.body.width;
            this._seekBarUI.slider.x = this._seekBarUI.playBar.tail.x;
            this._seekBarUI.forWardBtn.x = param1 - this._seekBarUI.forWardBtn.width;
            if(this._focusPointHead)
            {
               this.onResizePoint(this._focusPointHead,true);
            }
            if(this._focusPointTail)
            {
               this.onResizePoint(this._focusPointTail,true);
            }
            _loc3_ = 0;
            while(_loc3_ < this._viewPoints.length)
            {
               this.onResizePoint(this._viewPoints[_loc3_],true);
               _loc3_++;
            }
            if(!(this._filterData == null) && this._filterData.length > 0)
            {
               this._filterShape.graphics.clear();
               this._filterShape.graphics.beginFill(FILTER_COLOUR);
               _loc4_ = 0;
               while(_loc4_ < this._filterData.length)
               {
                  this.resizeSkipPart(this._filterData[_loc4_],true);
                  _loc4_++;
               }
               this._filterShape.graphics.endFill();
            }
         }
         else
         {
            this._seekBarUI.seekBarBg.height = this._seekBarUI.playBarHead.height;
            this._seekBarUI.loadBar.height = this._seekBarUI.playBarHead.height;
            this._seekBarUI.playBar.height = this._seekBarUI.playBarHead.height;
            this._seekBarUI.seekBarBg.x = 0;
            this._seekBarUI.seekBarBg.body.x = 0;
            this._seekBarUI.seekBarBg.body.width = param1;
            this._seekBarUI.loadBar.x = 0;
            this._seekBarUI.loadBar.body.x = 0;
            this._seekBarUI.loadBar.body.width = 1 * param1 * this._bufferTime / this._totalTime;
            this._seekBarUI.playBar.x = 0;
            this._seekBarUI.playBar.body.x = 0;
            this._seekBarUI.playBar.body.width = 1 * param1 * this._currentTime / this._totalTime;
            this._seekBarUI.playBarHead.x = this._seekBarUI.playBar.body.width - this._seekBarUI.playBarHead.width;
            if(this._focusPointHead)
            {
               this.onResizePoint(this._focusPointHead,false);
            }
            if(this._focusPointTail)
            {
               this.onResizePoint(this._focusPointTail,false);
            }
            _loc3_ = 0;
            while(_loc3_ < this._viewPoints.length)
            {
               this.onResizePoint(this._viewPoints[_loc3_],false);
               _loc3_++;
            }
            if(!(this._filterData == null) && this._filterData.length > 0)
            {
               this._filterShape.graphics.clear();
               this._filterShape.graphics.beginFill(FILTER_COLOUR);
               _loc4_ = 0;
               while(_loc4_ < this._filterData.length)
               {
                  this.resizeSkipPart(this._filterData[_loc4_],false);
                  _loc4_++;
               }
               this._filterShape.graphics.endFill();
            }
         }
         this._previewTip.realWidth = param1;
         this._previewTip.mediaSprite.currentX = this._seekBarUI.seekBarBg.body.x + this._previewTip.time / this._totalTime * this._seekBarUI.seekBarBg.body.width;
      }
      
      public function setTotalTime(param1:int) : void {
         this._totalTime = param1;
      }
      
      public function setCurrentTime(param1:int) : void {
         this._currentTime = param1;
      }
      
      public function onPlayerRunning(param1:int, param2:int, param3:Boolean = false) : void {
         this._currentTime = param1;
         this._bufferTime = param2;
         if(this._status.hasStatus(ControllBarDef.STATUS_SEEK_BAR_THICK))
         {
            this._seekBarUI.loadBar.body.width = 1 * this._seekBarUI.seekBarBg.body.width * param2 / this._totalTime;
            this._seekBarUI.loadBar.tail.x = this._seekBarUI.loadBar.body.x + this._seekBarUI.loadBar.body.width;
            if(!this._mouseMoved && !this._seekBtnDowned && !param3)
            {
               this._seekBarUI.playBar.body.width = 1 * this._seekBarUI.seekBarBg.body.width * this._currentTime / this._totalTime;
               this._seekBarUI.playBar.tail.x = this._seekBarUI.playBar.body.x + this._seekBarUI.playBar.body.width;
            }
            if(!this._mouseDowned && !this._seekBtnDowned && !param3)
            {
               this._seekBarUI.slider.x = this._seekBarUI.playBar.tail.x;
            }
         }
         else if(!this._seekBtnDowned && !param3)
         {
            this._seekBarUI.loadBar.body.width = 1 * this._seekBarUI.seekBarBg.body.width * this._bufferTime / this._totalTime;
            this._seekBarUI.playBar.body.width = 1 * this._seekBarUI.seekBarBg.body.width * this._currentTime / this._totalTime;
            this._seekBarUI.playBarHead.x = this._seekBarUI.playBar.body.width - this._seekBarUI.playBarHead.width;
         }
         
         if(!(this._filterData == null) && this._filterData.length > 0)
         {
            this._seekBarUI.loadBar.visible = false;
            this._filterShape.visible = true;
         }
         else
         {
            this._seekBarUI.loadBar.visible = true;
            this._filterShape.visible = false;
         }
         this._seekBarUI.playBar.visible = true;
      }
      
      public function updateSeekBarView() : void {
         if(this._seekTime > this._totalTime)
         {
            this._seekTime = this._totalTime;
         }
         if(this._seekTime < 0)
         {
            this._seekTime = 0;
         }
         this._seekBarUI.playBar.body.width = 1 * this._seekTime / this._totalTime * this._seekBarUI.seekBarBg.body.width;
         this._seekBarUI.playBar.tail.x = this._seekBarUI.playBar.body.x + this._seekBarUI.playBar.body.width;
         this._seekBarUI.slider.x = this._seekBarUI.playBar.tail.x;
         if(!this._status.hasStatus(ControllBarDef.STATUS_SEEK_BAR_THICK))
         {
            this._seekBarUI.playBarHead.x = this._seekBarUI.playBar.body.width - this._seekBarUI.playBarHead.width;
         }
         this._previewTip.x = this._seekBarUI.slider.x;
         this._previewTip.previewTime(Strings.formatAsTimeCode(this._seekTime / 1000,this._totalTime > ConstUtils.H_2_MS),this._seekTime);
         if(this._previewTip.parent == null)
         {
            addChildAt(this._previewTip,0);
         }
      }
      
      public function hidePreviewTip() : void {
         if(this._previewTip.parent)
         {
            this._previewTip.hidePreview();
            removeChild(this._previewTip);
            if(this._previewVedioShown)
            {
               this._previewVedioShown = false;
               dispatchEvent(new ControllBarEvent(ControllBarEvent.Evt_PreviewVedioShow,
                  {
                     "show":this._previewVedioShown,
                     "x":0
                  }));
            }
         }
      }
      
      private function onResizePoint(param1:FocusPoint, param2:Boolean) : void {
         if(param2)
         {
            param1.width = 4;
            param1.height = 4;
         }
         else
         {
            param1.width = 3;
            param1.height = 3;
         }
         param1.x = this._seekBarUI.seekBarBg.body.x + param1.time / this._totalTime * this._seekBarUI.seekBarBg.body.width;
         param1.y = this._seekBarUI.seekBarBg.body.y + 2;
         param1.resize(param2);
      }
      
      private function resizeSkipPart(param1:ISkipPointInfo, param2:Boolean) : void {
         if(param1.endTime <= param1.startTime)
         {
            return;
         }
         var _loc3_:uint = this._seekBarUI.seekBarBg.body.x + param1.startTime / this._totalTime * this._seekBarUI.seekBarBg.body.width;
         var _loc4_:uint = this._seekBarUI.seekBarBg.body.y + 2;
         var _loc5_:uint = param2?5:3;
         var _loc6_:uint = (param1.endTime - param1.startTime) / this._totalTime * this._seekBarUI.seekBarBg.body.width;
         this._filterShape.graphics.drawRect(_loc3_,_loc4_,_loc6_,_loc5_);
      }
      
      private function onFocusPointHeadTailRollOver(param1:MouseEvent) : void {
         var _loc2_:FocusPoint = null;
         var _loc3_:* = 0;
         if(this._videoHeadTailTipPanel.parent == null)
         {
            _loc2_ = param1.currentTarget as FocusPoint;
            this._videoHeadTailTipPanel.y = localToGlobal(new Point(0,_loc2_.y - this._videoHeadTailTipPanel.height)).y;
            _loc3_ = localToGlobal(new Point(_loc2_.x + _loc2_.width / 2 - this._videoHeadTailTipPanel.width / 2,0)).x;
            if(_loc3_ <= 0)
            {
               _loc3_ = _loc3_ + 15;
            }
            if(_loc3_ >= GlobalStage.stage.stageWidth - this._videoHeadTailTipPanel.width - 1)
            {
               _loc3_ = GlobalStage.stage.stageWidth - this._videoHeadTailTipPanel.width - 5;
            }
            this._videoHeadTailTipPanel.x = _loc3_;
            this._videoHeadTailTipPanel.updateTip();
            GlobalStage.stage.addChild(this._videoHeadTailTipPanel);
            this._videoHeadTailTipPanel.addEventListener(MouseEvent.ROLL_OUT,this.onHeadTailTipPanelOut);
         }
      }
      
      private function onFocusPointHeadTailRollOut(param1:MouseEvent) : void {
         var _loc2_:FocusPoint = param1.currentTarget as FocusPoint;
         if(!(mouseX >= _loc2_.x + _loc2_.width / 2 - 4 && mouseX <= _loc2_.x + _loc2_.width / 2 + 4) || mouseY >= _loc2_.y)
         {
            this.onHeadTailTipPanelOut(null);
         }
      }
      
      private function onHeadTailTipPanelOut(param1:MouseEvent) : void {
         this._videoHeadTailTipPanel.removeEventListener(MouseEvent.ROLL_OUT,this.onHeadTailTipPanelOut);
         if(this._videoHeadTailTipPanel.parent)
         {
            GlobalStage.stage.removeChild(this._videoHeadTailTipPanel);
         }
      }
      
      private function onForWardBtnMouseDown(param1:MouseEvent) : void {
         if(this._seekBtnDowned)
         {
            return;
         }
         GlobalStage.stage.addEventListener(MouseEvent.MOUSE_UP,this.onForWardBtnMouseUp);
         this._seekTime = this._currentTime;
         this._seekBtnDowned = true;
         TweenLite.delayedCall(1 * ControllBarDef.FF_BUTTONDOWNED_DELAY / 1000,this.onTimerStart,[true]);
         PingBack.getInstance().userActionPing(PingBackDef.FSTFRWRD);
      }
      
      private function onTimerStart(param1:Boolean) : void {
         if(!this._seekBtnDowned)
         {
            return;
         }
         TweenLite.killTweensOf(this.onTimerStart);
         if(param1)
         {
            this._timer.addEventListener(TimerEvent.TIMER,this.onForwardUpdateSeekBarView);
         }
         else
         {
            this._timer.addEventListener(TimerEvent.TIMER,this.onBackwardUpdateSeekBarView);
         }
         this._timer.start();
      }
      
      private function onForWardBtnMouseUp(param1:MouseEvent) : void {
         TweenLite.killTweensOf(this.onTimerStart);
         GlobalStage.stage.removeEventListener(MouseEvent.MOUSE_UP,this.onForWardBtnMouseUp);
         this._timer.stop();
         this._timer.removeEventListener(TimerEvent.TIMER,this.onForwardUpdateSeekBarView);
         this.onForwardUpdateSeekBarView(null);
         this._seekBtnDowned = false;
         this._seekClickCount++;
         dispatchEvent(new ControllBarEvent(ControllBarEvent.Evt_Seek,this._seekTime));
         this.hidePreviewTip();
      }
      
      private function onBackWardBtnMouseDown(param1:MouseEvent) : void {
         if(this._seekBtnDowned)
         {
            return;
         }
         GlobalStage.stage.addEventListener(MouseEvent.MOUSE_UP,this.onBackWardBtnMouseUp);
         this._seekTime = this._currentTime;
         this._seekBtnDowned = true;
         TweenLite.delayedCall(1 * ControllBarDef.FF_BUTTONDOWNED_DELAY / 1000,this.onTimerStart,[false]);
         PingBack.getInstance().userActionPing(PingBackDef.REWIND);
      }
      
      private function onBackWardBtnMouseUp(param1:MouseEvent) : void {
         TweenLite.killTweensOf(this.onTimerStart);
         GlobalStage.stage.removeEventListener(MouseEvent.MOUSE_UP,this.onBackWardBtnMouseUp);
         this._timer.stop();
         this._timer.removeEventListener(TimerEvent.TIMER,this.onBackwardUpdateSeekBarView);
         this.onBackwardUpdateSeekBarView(null);
         this._seekBtnDowned = false;
         this._seekClickCount++;
         dispatchEvent(new ControllBarEvent(ControllBarEvent.Evt_Seek,this._seekTime));
         this.hidePreviewTip();
      }
      
      private function onSliderDown(param1:MouseEvent) : void {
         GlobalStage.stage.addEventListener(MouseEvent.MOUSE_MOVE,this.onStageMouseMove);
         GlobalStage.stage.addEventListener(MouseEvent.MOUSE_UP,this.onStageMouseUp);
         this._mouseDowned = true;
      }
      
      private function onSeekBarBgClick(param1:MouseEvent) : void {
         var _loc2_:int = globalToLocal(new Point(param1.stageX,param1.stageY)).x - this._seekBarUI.seekBarBg.body.x;
         var _loc3_:int = _loc2_ / this._seekBarUI.seekBarBg.body.width * this._totalTime;
         dispatchEvent(new ControllBarEvent(ControllBarEvent.Evt_Seek,_loc3_));
         this._seekClickCount++;
      }
      
      private function onViewPointClick(param1:MouseEvent) : void {
         var _loc2_:FocusPoint = param1.currentTarget as FocusPoint;
         dispatchEvent(new ControllBarEvent(ControllBarEvent.Evt_Seek,_loc2_.time));
         this._seekClickCount++;
      }
      
      private function onStageMouseMove(param1:MouseEvent) : void {
         if(!this._mouseDowned)
         {
            return;
         }
         var _loc2_:Number = mouseX;
         if(_loc2_ < this._seekBarUI.backWardBtn.width + this._seekBarUI.seekBarBg.head.width)
         {
            _loc2_ = this._seekBarUI.backWardBtn.width + this._seekBarUI.seekBarBg.head.width;
         }
         if(_loc2_ > this._seekBarUI.forWardBtn.x - this._seekBarUI.seekBarBg.tail.width)
         {
            _loc2_ = this._seekBarUI.forWardBtn.x - this._seekBarUI.seekBarBg.tail.width;
         }
         this._seekBarUI.playBar.body.width = _loc2_ - this._seekBarUI.playBar.body.x;
         this._seekBarUI.playBar.tail.x = _loc2_;
         this._seekBarUI.slider.x = _loc2_;
         this._mouseMoved = true;
         var _loc3_:int = 1 * (_loc2_ - this._seekBarUI.seekBarBg.body.x) / this._seekBarUI.seekBarBg.body.width * this._totalTime;
         this._previewTip.x = _loc2_;
         this._previewTip.previewTime(Strings.formatAsTimeCode(_loc3_ / 1000,this._totalTime > ConstUtils.H_2_MS),_loc3_);
         if(this._previewTip.parent == null)
         {
            this._previewTip.mediaSprite.addEventListener(PreviewEvent.PREVIEW_VIDEO_WND_SHOW,this.onPreviewVideoShow);
            addChildAt(this._previewTip,0);
         }
      }
      
      private function onStageMouseUp(param1:MouseEvent) : void {
         this._mouseDowned = false;
         this._mouseMoved = false;
         this._seekClickCount++;
         GlobalStage.stage.removeEventListener(MouseEvent.MOUSE_MOVE,this.onStageMouseMove);
         GlobalStage.stage.removeEventListener(MouseEvent.MOUSE_UP,this.onStageMouseUp);
         var _loc2_:int = 1 * (this._seekBarUI.playBar.tail.x - this._seekBarUI.playBar.body.x) / this._seekBarUI.seekBarBg.body.width * this._totalTime;
         dispatchEvent(new ControllBarEvent(ControllBarEvent.Evt_Seek,_loc2_));
         this.hidePreviewTip();
      }
      
      private function onSeekBarBgMouseMove(param1:MouseEvent) : void {
         var _loc2_:int = 1 * (mouseX - this._seekBarUI.seekBarBg.body.x) / this._seekBarUI.seekBarBg.body.width * this._totalTime;
         if((this._previewTip.enableMoveIn) && !(mouseX < this._previewTip.x + 15 && mouseX > this._previewTip.x - 15) || !this._previewTip.enableMoveIn)
         {
            this._previewTip.x = mouseX;
            this._previewTip.previewTime(Strings.formatAsTimeCode(_loc2_ / 1000,this._totalTime > ConstUtils.H_2_MS),_loc2_);
            if(this._previewTip.parent == null)
            {
               this._previewTip.mediaSprite.addEventListener(PreviewEvent.PREVIEW_VIDEO_WND_SHOW,this.onPreviewVideoShow);
               addChildAt(this._previewTip,0);
            }
         }
      }
      
      private function onViewPointRollOver(param1:MouseEvent) : void {
         var _loc2_:FocusPoint = null;
         if((this._previewTip.enableMoveIn) && !(mouseX < this._previewTip.x + 15 && mouseX > this._previewTip.x - 15) || !this._previewTip.enableMoveIn)
         {
            _loc2_ = param1.currentTarget as FocusPoint;
            if(this._previewTip.parent == null)
            {
               this._previewTip.mediaSprite.addEventListener(PreviewEvent.PREVIEW_VIDEO_WND_SHOW,this.onPreviewVideoShow);
               addChildAt(this._previewTip,0);
            }
            this._previewTip.x = _loc2_.x + _loc2_.width / 2;
            this._previewTip.previewSpots(_loc2_.content,Strings.formatAsTimeCode(_loc2_.time / 1000,this._totalTime > ConstUtils.H_2_MS),_loc2_.time);
         }
      }
      
      private function onViewPointRollOut(param1:MouseEvent) : void {
         var _loc2_:FocusPoint = param1.currentTarget as FocusPoint;
         if(mouseY > this._previewTip.y)
         {
            this.hidePreviewTip();
         }
      }
      
      private function onSeekBarBgRollOut(param1:MouseEvent) : void {
         if(!this._previewTip.enableMoveIn || mouseY > this._seekBarUI.seekBarBg.body.y + this._seekBarUI.seekBarBg.body.height)
         {
            this.hidePreviewTip();
         }
      }
      
      private function onPreviewTipRollOut(param1:MouseEvent) : void {
         this.hidePreviewTip();
      }
      
      private function onPreviewTipClick(param1:MouseEvent) : void {
         dispatchEvent(new ControllBarEvent(ControllBarEvent.Evt_Seek,this._previewTip.time));
      }
      
      private function onPreviewVideoShow(param1:PreviewEvent) : void {
         this._previewVedioShown = true;
         dispatchEvent(new ControllBarEvent(ControllBarEvent.Evt_PreviewVedioShow,
            {
               "show":this._previewVedioShown,
               "x":int(localToGlobal(new Point(this._previewTip.x,0)).x)
            }));
      }
      
      private function initUI() : void {
         this.initPreviewTip();
         this._filterShape = new Shape();
         addChild(this._seekBarUI.bg);
         addChild(this._seekBarUI.backWardBtn);
         addChild(this._seekBarUI.seekBarBg);
         addChild(this._seekBarUI.forWardBtn);
         addChild(this._seekBarUI.loadBar);
         addChild(this._filterShape);
         addChild(this._seekBarUI.playBar);
         addChild(this._seekBarUI.playBarHead);
         addChild(this._seekBarUI.slider);
         this._thickBarsHeight.seekBarBgH = this._seekBarUI.seekBarBg.height;
         this._thickBarsHeight.loadBarH = this._seekBarUI.loadBar.height;
         this._thickBarsHeight.playBarH = this._seekBarUI.playBar.height;
         this._seekBarUI.playBarHead.y = this._seekBarUI.playBar.y;
         this._seekBarUI.loadBar.visible = false;
         this._seekBarUI.playBar.visible = false;
         this._seekBarUI.playBarHead.visible = false;
      }
      
      private function initPreviewTip() : void {
         this._previewTip = new Preview();
         if(FlashVarConfig.owner == FlashVarConfig.OWNER_CLIENT)
         {
            this._previewTip.cacheAsBitmap = true;
         }
         this._previewTip.y = this._seekBarUI.seekBarBg.y + 2;
         this._previewTip.buttonMode = true;
         this._previewTip.gap = 8;
         this._previewTip.addEventListener(MouseEvent.CLICK,this.onPreviewTipClick);
         this._previewTip.addEventListener(MouseEvent.ROLL_OUT,this.onPreviewTipRollOut);
         this._previewTip.addEventListener(PreviewEvent.PREVIEW_PINGBAK,this.onPreviewPingBack);
      }
      
      private function onForwardUpdateSeekBarView(param1:TimerEvent) : void {
         this._seekTime = this._seekTime + 10000;
         this.updateSeekBarView();
      }
      
      private function onBackwardUpdateSeekBarView(param1:TimerEvent) : void {
         this._seekTime = this._seekTime - 10000;
         this.updateSeekBarView();
      }
      
      private function onPreviewPingBack(param1:PreviewEvent) : void {
         PingBack.getInstance().previewActionPing(this._previewTip.time);
      }
   }
}
